CLOSE TABLES ALL 
CLEAR && clear display
use dov in b &&open file dov
use op in a && open file oper
INDEX on kod_op TO op && sort data in oper file
SET RELATION TO kod_gp INTO b
@ 1,15 say 'Statement of accounting medicines'Font 'Courier',10 &&print to display
@ 2,5 say '============================================='Font 'Courier',14
@ 3,5 say '|Cod of|name of|     |      |       |       |'Font 'Courier',14                    
@ 4,5 say '| med. | med.  |units|Price |Number | Suma  |'Font 'Courier',14            
@ 5,5 say '|      |       |     |      |       |       |'Font 'Courier',14   
@ 6,5 say '============================================='Font 'Courier',14
x=7 
sumazah=0
do while !eof() && while not end of file
sumal=0
nom=kod_op
DO while nom=kod_op
 suma=a->kilkist*b->cina
 sumal=sumal+suma
  @ x,10 say kod_gp
  @ x,20 say b->nazva
  @ x,37 say b->odunuzi 
  @ x,45 say b->cina 
  @ x,57 say a->kilkist
  @ x,70 say suma 
  x=x+1
skip
enddo
@ x,20 say 'Suma by operation"s code'Font 'Courier',11 
@x,70 say sumal   
x=x+1
@ x,5 say '------------------------------------------------------------------------------------------------------' 
x=x+1
sumazah=sumazah+sumal
ENDDO
@ x,20 say 'Suma by all operation 'Font 'Courier',11 
@x,70 say sumazah   
x=x+1
@ x,5 say '------------------------------------------------------------------------------------------------------' 
x=x+1
CLOSE TABLES ALL 